# Contributor: Fabricio Silva <hi@fabricio.dev>
# Maintainer: Fabricio Silva <hi@fabricio.dev>
pkgname=py3-qbittorrent-api
pkgver=2024.9.67
pkgrel=0
pkgdesc="Python client implementation for qBittorrent's Web API"
url="https://github.com/rmartin16/qbittorrent-api"
arch="noarch"
license="MIT"
depends="
	py3-requests
	py3-setuptools
	"
makedepends="
	py3-gpep517
	py3-wheel
	py3-setuptools_scm
	py3-sphinx-copybutton
	py3-sphinx-autodoc-typehints
	"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rmartin16/qbittorrent-api/archive/v$pkgver.tar.gz"
builddir="$srcdir/qbittorrent-api-$pkgver"
# tests requires an instance of qbittorrent running
# net for sphinx
options="net !check"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
	sphinx-build -b man docs/source docs/build
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	install -Dm644 docs/build/qbittorrent-api.1 \
		-t "$pkgdir"/usr/share/man/man1

	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/tests
}

sha512sums="
cc1fe101461df180e077a46cb98a2e939b80cf4858e810ddf36845d6006d493a0b9300cf06041187b59052062f5d2020cecf41fcec52db29091c5c89680822fb  py3-qbittorrent-api-2024.9.67.tar.gz
"
